<div style="display: none; height: 0;" class="pop-up" id="pError">
    <p>
        <span id="msgError">Email hoặc mật khẩu của bạn không hợp lệ.</span>
    </p>
</div>
<{ foreach from=$listDeals item=item name='deal'}>
<{if $smarty.foreach.deal.index == 0}>
<!-- deal feature -->
<div style="width:988px;margin-left:-5px;#margin-left:-13px;">
    <!--one deal-->
    <div class="box-white box-big" id="dMainDeal">
		<div class="box-white-image-big">  
		  <div class="one-img-slideshow">
		  	<div id="dListIMGSlideShow" class="slideshow-inner">
			<{foreach from=$this->explodePicture($item.picture) item=pic name='pic'}>
				<{if $smarty.foreach.pic.index==0}>
					<a target="_blank" title="<{$item.groupon_name}>" name="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>" id="s<{$smarty.foreach.pic.index + 1}>" style="margin: 0pt; display: block;">
			  		 	<img width="418" height="259" alt="<{$item.groupon_name}>" title="" src="<{$pic}>" itemprop="image">
			  		 </a>
		  		 <{/if}>			
			<{/foreach}>  
		  		</div> </div><div class="btn-slide"> 
		  			<ul id="thumbs">
		  			<{foreach from=$this->explodePicture($item.picture) item=pic1 name='pic1'}>
			  			<!-- <li onclick="selectSlide(<{$smarty.foreach.pic1.index }>)" id="i<{$smarty.foreach.pic1.index + 1}>" class="<{if $smarty.foreach.pic1.index==0}>activeSlide<{/if}>">
			  				<a href="javascript:void(0);" name=""><{$smarty.foreach.pic1.index + 1}></a>
			  			</li>-->
		  			<{/foreach}>  
				</ul>
			 </div> </div>
        <div class="box-white-content">
            <div class="box-white-subcr">
                <h2>
                    <a name="" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>" itemprop="name"><{$item.groupon_name}></a>
                </h2>
                <p itemprop="description">
					<{$item.title|truncate:170}>
				</p>
                <p class="box-white-detail">
                    <a name="" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>">... xem chi tiết</a></p>
                <div style="margin-top:14px;"><span class="box-white-quote">
                        <img width="31" height="29" alt="" title="" src="<{$APPLICATION_URL}>/Themes/Default/Images/images/quote.gif">
                    </span>
                    <a name="<{$item.groupon_name}>" title="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/DealComment/Index/city/<{$city}>/id/<{$item.deal_id}>" class="box-white-slogan">
					<{$this->getCommentDefault($item.deal_id)|truncate:200}></a>
                </div>
            </div>
            <div class="box-white-btn">
                <div itemtype="http://data-vocabulary.org/Offer" itemscope="" itemprop="offerDetails" class="box-white-info-big">
                    <div class="view-price">
                        <div class="remain">
                            <span class="style-font"><{$item.sale_price|number_format}><em> VNĐ</em></span>
                        </div>
                        <a class="view-button" name="" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>"></a>
                    </div>
                    <div class="clear"></div>

                </div>
                <div style="float:none; width:auto; padding-top:10px;" class="box-white-info-price">
                    <p>Giá gốc: <span><{$item.original_price|number_format}></span> VNĐ</p></div>
                <div class="box-white-info-sale">
                    <div class="box-white-info-save">
                        <span class="number"><{math equation="(a-b)/a*100" a=$item.original_price b=$item.sale_price format="%d"}>%</span>
                        <span>tiết kiệm</span>
                    </div>
                    <div class="box-white-info-buyer">
                        <span class="number"><{$item.bought_count}></span>
                        <span>người mua</span>
                    </div>
                    <div class="box-white-info-time">
                        <span id="Time_CountDown_<{$item.deal_id}>" class="number">0:0:0</span>
                        <span>thời gian còn lại</span>
                    </div><div class="clear"></div>

                </div></div>
            <div class="box-white-info-links">

            </div>
        </div>
    </div>
    <div class="clear">
        
    </div>

</div>
<!-- end deal feature-->
	<script type="text/javascript">
	//<![CDATA[
	var arrPhotoSlide = new Array();
	<{foreach from=$this->explodePicture($item.picture) item=picture name='picture'}>
		arrPhotoSlide[<{$smarty.foreach.picture.index}>]= "<{$picture}>";
	<{/foreach}>
	//]]>
	</script>
<{else}>
<!-- list deals -->
<div id="dListDeal" class="dListDeal">
    <div class="box-white">
        <div class="box-white-image">
            <a title="<{$item.groupon_name}>" name="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>">
                <img width="298" height="184" alt="<{$item.groupon_name}>" title="<{$item.groupon_name}>" src="<{$grouponEntity->getImage($item.picture)}>">
            </a>
            <i></i>
        </div>
        <div class="box-white-text">
            <h3>
                <a title="<{$item.groupon_name}>" name="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>"><{$item.groupon_name}></a>
            </h3>
            <p>
				<{$item.title|truncate:170}>
			</p>
            <p class="box-white-detail"><a name="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>">... xem chi tiết</a></p>
            <div>
                <span class="box-white-quote">
                    <img width="31" height="29" alt="" title="" src="<{$APPLICATION_URL}>/Themes/Default/Images/images/quote.gif">
                </span>
                <a name="<{$item.groupon_name}>" title="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/DealComment/Index/city/<{$city}>/id/<{$item.deal_id}>" class="box-white-slogan">
                <{$this->getCommentDefault($item.deal_id)|truncate:150}>
                </a>
            </div>
        </div>
        <div class="box-white-info">
            <p><{$item.sale_price|number_format}><strong> VNĐ</strong></p>
            <p><a class="view-button" title="<{$item.groupon_name}>" name="<{$item.groupon_name}>" href="<{$APPLICATION_URL}>/Browse/Deals/details/city/<{$city}>/id/<{$item.deal_id}>"></a></p>
            <div class="box-white-info-sale">
                <div class="box-white-info-save">
                    <span class="number"><{math equation="(a-b)/a*100" a=$item.original_price b=$item.sale_price format="%d"}>%</span><span>tiết kiệm</span>
                </div>
                <div class="box-white-info-buyer">
                    <span class="number"><{$item.bought_count}></span><span>người mua</span>
                </div>
                <div class="box-white-info-time">
                    <span id="Time_CountDown_<{$item.deal_id}>" class="number">0:0:0</span>
                    <span>thời gian còn lại</span>
                </div>
                <div class="clear"></div>
            </div>   <div class="box-white-info-price">
                <p>Giá gốc: <span><{$item.original_price|number_format}></span> VNĐ</p>
            </div>
            <div class="box-white-info-links">

               
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>

    <!-- end list deals -->
    <{/if}>     
    <script type="text/javascript">
                                   CountBack("Time_CountDown_<{$item.deal_id}>", "<{$this->calculatorDuration($item.expired_deal)}>");
                                 /*
                            Author:		Robert Hashemian (http://www.hashemian.com/)
                            Modified by:	Munsifali Rashid (http://www.munit.co.uk/)
                            Modified by:	Tilesh Khatri
                                 */

                                function StartCountDown(myDiv,myTargetDate)
                                {
                                    var dthen	= new Date(myTargetDate);
                                    var dnow	= new Date();
                                    ddiff		= new Date(dthen-dnow);
                                    gsecs		= Math.floor(ddiff.valueOf()/1000);
                                    CountBack(myDiv,gsecs);
                                }

                                function Calcage(secs, num1, num2)
                                {
                                    s = ((Math.floor(secs/num1))%num2).toString();
                                    if (s.length < 2)
                                    {
                                        s = "0" + s;
                                    }
                                    return (s);
                                }

                                function CountBack(myDiv, secs)
                                {
                                    var DisplayStr;
                                    var DisplayFormat = "%%d%% ngày %%H%%:%%M%%:%%S%%";                                    //var DisplayFormat = "%%H%%:%%M%%:%%S%%";
//                                    if(Calcage(secs,86400,100000)> 0){                                      
                                    	DisplayStr = DisplayFormat.replace(/%%d%%/g,	Calcage(secs,86400,100000));
//                                    }else{
//                                    	DisplayStr = DisplayFormat.replace(/%%d%%/g,	);
//                                    	DisplayStr = DisplayFormat.replace(/ ngày /g,	"");
//                                    }
                                    DisplayStr = DisplayStr.replace(/%%H%%/g,		Calcage(secs,3600,24));
                                    DisplayStr = DisplayStr.replace(/%%M%%/g,		Calcage(secs,60,60));
                                    DisplayStr = DisplayStr.replace(/%%S%%/g,		Calcage(secs,1,60));
                                    if(secs > 0)
                                    {
                                        document.getElementById(myDiv).innerHTML = DisplayStr;
                                        setTimeout("CountBack('" + myDiv + "'," + (secs-1) + ");", 990);
                                    }
                                    else
                                    {
                                        
                                    }
                                }
                                     
                                </script>
 <{/foreach}>
